function smallestCommons(arr) {
    arr.sort((a, b) => a - b);
    let num = arr[0];
    for (let i = arr[0] + 1; i <= arr[1]; i++) {
        num *= i / gcd(i, num);
    }
    return num;
}
function gcd(m, n) {
    if (m % n === 0) return n;
    return gcd(n, m % n);
}

console.log(smallestCommons([2, 10]));
